//初始化路由
const express = require('express');
const router = express.Router();
//导入路由函数
const router_handler = require('../router_handler/user');
//导入验证表单数据的中间件
const expressjoi = require("@escook/express-joi");
//导入需要验证的规则对象
const { reg_login_schema } = require('../schema/user')

// 注册新用户
//在路由中传入局部中间件expressjoi(reg_login_schema)
router.post('/reguser', expressjoi(reg_login_schema), router_handler.reguser)

// 登录
//在路由中传入局部中间件expressjoi(reg_login_schema)
router.post('/login', expressjoi(reg_login_schema), router_handler.login)

module.exports = router;